/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"14601FF1-3EDC-47A2-924E-AE71CDEE2A85"}
 */
function español(event) {
	setLocale('es', 'AR')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"81A3AE4A-E75A-4333-87DA-6A1A38DFC442"}
 */
function ingles(event) {
	setLocale('en', 'UK')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"240B813D-26B8-4A04-9479-E3D1C14C6043"}
 */
function portugues(event) {
	setLocale('pt', 'BR')
}

/**
 * @param {String} idioma
 * @param {String} pais
 *
 * @properties={typeid:24,uuid:"AAB69DAA-F036-473A-ABCA-36A21F76DDC3"}
 */
function setLocale(idioma, pais)
{
	globals.gLocale = idioma
	i18n.setLocale(idioma, pais)
	
	forms.home_cabecera.controller.recreateUI()
	forms.reserva_1.controller.recreateUI()
	forms.reserva_3.controller.recreateUI()
	forms.reserva_4.controller.recreateUI()
	forms.reserva_4_detalle.controller.recreateUI()
	forms.reserva_4_pago.controller.recreateUI()
	forms.home_pie.controller.recreateUI()
	forms.calendario.controller.recreateUI()
	forms.home.elements.tab_promos.removeAllTabs()
	forms.home.controller.recreateUI()

	forms.reserva_3.onShow(null,null,1)
	reserva_2()
	globals.cambiaHotel()
}

/**
 * @properties={typeid:24,uuid:"80491FAD-92E4-4826-9109-0BD5E965612A"}
 */
function reserva_2()
{
	var $enabled = []
	for (var i = 1 ; i <= forms.reserva_2.elements.tab_resultados.getMaxTabIndex() ; i++)
	{
		var $en = forms.reserva_2.elements.tab_resultados.isTabEnabledAt(i)
		if ($en == false)
			$enabled.push(i)
	}
	forms.reserva_2.elements.tab_resultados.removeAllTabs()
	forms.reserva_2.controller.recreateUI()
	forms.reserva_2_hab.controller.recreateUI()
	for (var i = 1 ; i <= 3 ; i++)
	{
		if (solutionModel.getForm('hab'+i))
		{
			forms['hab'+i].controller.recreateUI()
			forms.reserva_2.elements.tab_resultados.addTab('hab'+i,'hab'+i,i18n.getI18NMessage('hoteleria.habitacion')+ ' ' + i)
			if ($enabled.indexOf(i) != -1)
				forms.reserva_2.elements.tab_resultados.setTabEnabledAt(i,false)
			else
				forms.reserva_2.elements.tab_resultados.tabIndex = i
		}
	}
}
/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E52F2B27-3E25-4D78-B635-79E7C436EA53"}
 */
function iraHome(event) {
	globals.show('home')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"EFA064B8-26EF-45AC-B39E-F69CC78DD39F"}
 */
function iraMiCuenta(event) {
	globals.show('mi_cuenta')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"8B7A5CD8-9683-4BBD-80F9-5E9FBB143223"}
 */
function salir(event) {
	application.exit()
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"36F7AB29-0D3A-45AB-830E-1AA7B5EFAA8E"}
 */
function iraPromociones(event) {
	if (promociones_vigentes.getSize() == 0)
		globals.DIALOGS.showInfoDialog(i18n.getI18NMessage('hoteleria.aviso'),i18n.getI18NMessage('hoteleria.promociones.noHay'),'OK')
	else
	{
		forms.promociones_cab_lst.controller.loadRecords(promociones_vigentes)
		forms.promociones_cab_lst.controller.show()
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"0FE5F2A2-C365-4FD8-AED6-773807B10CFB"}
 */
function volverSitio(event) {
	if (ghotel_to_hoteles.direccion_web == null)
	{
		var $sitio = 'http://prueba.infocomsa.com.ar/hotel_prueba'
	}
	else
	{
		var $sitio = 'http://'+ghotel_to_hoteles.direccion_web
	}
	application.showURL($sitio,'_self')
	application.exit()
}
